package com.fafa.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.Arrays;

//在templates下的所有页面，只能通过controller进行访问；
@Controller
public class IndexControlller {

    @RequestMapping("/test")
    public String a1(Model model){
        model.addAttribute("msg","<h1>SpringBoot yyds!</h1>");
        model.addAttribute("users", Arrays.asList("Fafa","Sire"));  //里面的方法可以将数组转为List集合
        return "index";
    }
    //首页（登录页面）
    @RequestMapping({"","/login.html"})
    public String index(){
        return "login";
    }
    //主要内容
    @RequestMapping("dashboard")
    public String dash(){
        return "dashboard";
    }


}
